<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Menu</title>
  
                                             <meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>

<body>
       <h1>class <tt>Menu</tt></h1>
            <p>From the point of view of the PyGUI API, a Menu is a collection of commands 
  that the user can invoke. The manner in which these commands are made available 
  to the user is platform-dependent, but typically a Menu instance will correspond 
  to a pull-down menu in a menu bar.<br>
     </p>
         <p>At any given moment, two sets of menus are available to the user, a set 
  of <i>application-wide</i> menus determined by the <tt>menus</tt> attribute 
  of the application object, and a set of <i>window-specific</i> menus determined 
  by the <tt>menus</tt> attribute of the currently active window.</p>
            <p>A menu consists of a sequence of <i>menu</i> <i>items</i>, each of which 
  has the following characteristics:</p>
            <ul>
      <li>A <i>label</i></li>
       <li>An optional <i>keyboard equivalent</i></li>
       <li>An optional <i>check mark</i></li>
       <li>An <i>enabled/disabled status</i><br>
       </li>
       <li>An internal<i> command name</i> for binding the menu item to an
 action</li>
           </ul>
              <p>A menu item can stand alone, or it can be part of an <i>indexed group</i>   of items which share the same command name and are distinguished by an integer
  index. Examples of uses for indexed groups include a list of window titles
  in a "Windows" menu, or a list of font names in a "Font" menu.<br>
     </p>
         <p>A menu can also contain separators for dividing items into visual groupings.<br>
     </p>
         <p>The label, keyboard equivalent and command name of a stand-alone menu item
are established when the menu is created and cannot be changed thereafter, 
  other than by discarding the whole Menu instance and creating a new one. 
 In contrast, the enabled/disabled status and check mark of each item, and 
 the contents of indexed groups, is established dynamically during the <i>setup 
  phase</i> of menu command processing. See <a href="menu_setup.html">Menu 
 Setup</a> for more information.<br>
   </p>
     <p>When a menu item is invoked by the user, its associated command name is 
 sent as a message up the message handling path starting from the current 
target (see <a href="event_handling.html">Event Handling</a>). If the item 
is part of an indexed group, its index is passed as a parameter of the message.<br>
     </p>
            <h2>Properties</h2>
            <blockquote>                 <dl>
    <dt><tt>title</tt></dt>
    <dd><i>Read-only.</i> Title of the menu, to appear in the menu bar.</dd>
  </dl>
     </blockquote>
            <h2>Constructor</h2>
            <dl>
  <dl>
    <dt><tt>Menu(title,</tt> <i>item_spec</i><span style="font-style: italic;">s</span><tt>)</tt></dt>
    <dd>Creates a Menu with the given title and the specified items. The <span style="font-style: italic;">item_specs</span> is a&nbsp; sequence of item specifications, each of which is one of the following:</dd>
    <dd><br>
     </dd>
    <dd>                         <ul>
             <li>A MenuItem instance<br>
</li><li>The string <tt>'-'</tt> (hyphen) representing a separator.</li>

           <li>A tuple <tt>(</tt><i>item_descriptor</i><tt>,</tt> <i>command_name</i><tt>)</tt>  representing a stand-alone menu item.</li>
           <li>A tuple <tt>([</tt><i>item_descriptor</i><tt>,</tt> ...<tt>],</tt>            <i>command_name</i><tt>)</tt> representing an indexed group of 
menu items.<br>
           </li>
                                           </ul>
             </dd>
    <dd><br>
  An <i>item descriptor</i> is a string specifying the item's label, optionally
 ending with '<tt>/</tt>' (a slash) followed by a <i>keyboard equivalent</i>. 
The keyboard equivalent consists of a <i>basic command character</i>, optionally 
preceded by one or more characters representing additional <i>modifiers </i>beyond 
the platform's standard menu-command modifier key.&nbsp;</dd>
    <dd><br>
     </dd>
    <dd>The basic command character should be either an uppercase letter, 
a digit, or one of the following characters: <tt>`-=[]\;',./</tt></dd>
    <dd><br>
     </dd>
    <dd>An additional modifier character is one of the following:</dd>
    <dd><br>
     </dd>
    <dd>                          <ul>
           <li><tt>^</tt> (caret), representing the shift key.</li>
           <li><tt>@</tt> (at-sign), representing a platform-dependent modifier 
key. On the Macintosh it is the Option key; its meaning on other platforms 
is yet to be determined.</li>
                             </ul></dd>
  </dl><dt><br>
  </dt>
</dl>
<h2>Properties</h2>
<div style="margin-left: 40px;">
<dl>
  <dt style="font-family: monospace;">special</dt>
  <dd>If true, then this is a menu that, by platform conventions,
should appear after other (non-special) menus in the menu bar. You
should probably not change this property yourself; it is used by the
framework code to achieve proper ordering of the standard menus.<br>
  </dd>
</dl>
</div>
<h2>Methods</h2>
<div style="margin-left: 40px;">
<dl>
  <dt><span style="font-family: monospace;">append(</span><span style="font-style: italic;">item</span><span style="font-family: monospace;">)</span></dt>
  <dd>Adds an item to the end of the menu. The <span style="font-style: italic;">item</span> should be an item specification as described above.<br>
    <br>
  </dd>
  <dt><span style="font-family: monospace;">extend(</span><span style="font-style: italic;">items</span><span style="font-family: monospace;">)</span></dt>
  <dd>Adds items to the end of the menu. The <span style="font-style: italic;">items</span> should be a sequence of item specifications as described above.<br>
    <br>
  </dd>
  <dt><span style="font-family: monospace;">item_with_command(</span><span style="font-style: italic;">command_name</span><span style="font-family: monospace;">)</span></dt>
  <dd>Returns the MenuItem having the given command name, or None if there is no such item.</dd>
</dl>
</div>
---<br>
<br>
<br>
<dl>
  <dt><br>
  </dt>

</dl>

   </body></html>